home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / 4th86_v4.zip / NUMTEST.4TH < prev    next >
Text File  |  1994-01-01  |  2KB  |  54 lines

  1. ( forget strt
  2. : strt ;  )
  3. off printload
  4. unsplit
  5.  
  6. 20 block buffer
  7. 15 buffer b!
  8.  
  9. : getstrg buffer getlin  ;
  10.  
  11. : makefp getstrg buffer 1+ fpeval  drop ;
  12.  
  13.  : fptest " floating point demonstration" ." crlf
  14.          " ============================" ." crlf
  15. " ( FPoint assumed -- no need for decimal point -- try 22 and 7 ) " ." crlf
  16.        " give FPoint value of numerator " ." makefp  crlf
  17.        " give FPoint denominator value  " ." makefp  crlf
  18.        "     FPoint quotient is         " ." f/ f. crlf crlf crlf ;
  19.  
  20.  
  21. : makesp getstrg buffer 1+ val ;
  22.  
  23. : SPtest " single precision demonstration "  ." crlf
  24.          " ============================== "  ." crlf
  25.         " give single precision numerator   "  ." makesp crlf
  26.     " give single precision denominator "  ." makesp crlf
  27.     "   single precision quotient is    "  ." / . crlf crlf crlf ;
  28.  
  29.  
  30. : DPtest " double precision demonstration "  ." crlf
  31.          " ============================== "  ." crlf
  32.         " give double precision numerator   "  ." makesp double crlf
  33.     " give double precision denominator "  ." makesp double crlf
  34.     "   double precision quotient is    "  ." ,/ ,. crlf crlf crlf ;
  35.  
  36.  : makefp2 getstrg buffer 1+ gval drop ; 
  37.  
  38. : fptest2 " alternative FPdemonstration" ." crlf
  39.          " ============================" ." crlf
  40. " ( essential to insert decimal point -- try 22.0 and 7.0 ) " ." crlf
  41.        " give FPoint value of numerator " ." makefp2 crlf
  42.        " give FPoint denominator value  " ." makefp2 crlf
  43.        "     FPoint quotient is         " ." f/ f. crlf ;
  44.  
  45. cls
  46. fptest
  47. sptest
  48. dptest
  49. fptest2
  50.  
  51.  
  52.  
  53.  
  54.